//-----------------------------------------------------------------------
// <copyright file="ArticleCatService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class ArticleCatService
    {
        #region ArticleCat

        public static void CreateArticleCat(ArticleCat articleCat)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                articleCatDAO.CreateArticleCat(articleCat);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateArticleCatException, ex);
            }
        }        

        public static void UpdateArticleCat(ArticleCat articleCat)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                articleCatDAO.UpdateArticleCat(articleCat);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateArticleCatException, ex);
            }
        }        

        public static void DeleteArticleCat(long categoryID)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                articleCatDAO.DeleteArticleCat(categoryID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteArticleCatException, ex);
            }
        }
        
        public static ArticleCat GetArticleCat(long categoryID)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                return articleCatDAO.GetArticleCat(categoryID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleCatException, ex);
            }
        }                

        public static ArticleCatCollection GetArticleCatList(ArticleCatColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                return articleCatDAO.GetArticleCatList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleCatListException, ex);
            }
        }        

        public static ArticleCatCollection GetArticleCatList(ArticleCatColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                return articleCatDAO.GetArticleCatList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleCatListException, ex);
            }
        }        

	    public static ArticleCatCollection GetArticleCatListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                return articleCatDAO.GetArticleCatListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleCatListException, ex);
            }
        }        

        public static ArticleCatCollection GetArticleCatListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                ArticleCatDAO articleCatDAO = new ArticleCatDAO();
                return articleCatDAO.GetArticleCatListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetArticleCatListException, ex);
            }
        }        

        #endregion
    }
}